<?php
include("../functions.php");
include("../libs/smarty.class.php");

$smarty = new Smarty();
$title = "Użytkownicy / Studenci";
$smarty->assign("title",$title);


if(isset($_POST['delete'])){
    if($_POST['cb']!=''){
        foreach($_POST['cb'] as $key => $value){
         $sql = mysql_query("DELETE FROM user_student WHERE id='$value'");
        }
        $info_action = getInfo(14);
        $info_color = "red";
    }else{
        $info_action = getInfo(18);
        $info_color = "red";
    }


}
$students = array();
$students = studentsInfo();

$remove_id  = $_GET['remove_id'];
if($remove_id != ''){
    echo deleteStudent($remove_id);
    $info_action = getInfo(14);
    $info_color = "red";
    $students = studentsInfo();

}

$smarty->assign("info_color",$info_color);
$smarty->assign("info_action",$info_action);
$smarty->assign("students",$students);
$smarty->display('students.tpl');
?>
